package json

import (
	"encoding/json"
	"fmt"
	"strconv"
)

type Jsrep struct {
	Cmd interface{} `json:"cmd"`
	Msg interface{} `json:"msg"`
}

func Jsonmr(cmd interface{}, msg interface{}) []byte {
	c := Jsrep{
		Cmd: cmd,
		Msg: msg,
	}
	jsonStu, err := json.Marshal(c)
	if err != nil {
		fmt.Println("生成json字符串错误")
	}
	return jsonStu
}

func Toint(string2 string) int{
	if s,err := strconv.Atoi(string2);err==nil{
		return s
	}
	return 0
}

